<?php
/**
 * 礼物列表
 * @return
 * @author yuncran@126.com
 */

namespace app\api\controller;

use app\BaseController;
use app\model\BuyGiftLogModel;
use app\model\GiftCategoryModel;
use app\model\GiftModel;

class Gift extends BaseController
{

    /**
     * 获取全部的礼物
     * @return void
     * @author yuncran@126.com
     */
    public function getGiftAll()
    {
        $data = GiftModel::getGiftAll($this->uid);
        return $this->renderSuccess($data);
    }

    public function getDetails()
    {
        $gift_id = $this->request->param('gift_id');
        $data = GiftModel::getDetails($gift_id);
        return $this->renderSuccess($data);
    }

    /**
     * 我的礼物列表
     * @return void
     * @author yuncran@126.com
     */
    public function getMyGift()
    {
        $data = BuyGiftLogModel::getGiftBuyAll($this->uid);
        return $this->renderSuccess($data);
    }

    /**
     * 礼物分类
     * @return void
     * @author yuncran@126.com
     */
    public function getClassList()
    {
        $data = GiftCategoryModel::where('status', 1)->field(['id',field('title'),'status','create_time'])->select();
        return $this->renderSuccess($data,'ok');
    }

}